package com.yunshipei.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;

import com.yunshipei.ui.activity.SplashActivity;

public class PushNotificationReceiver extends BroadcastReceiver {

    public static final String PUSH_URL = "com.yunshipei.enterplorer.push.url";
    public static final String EXTRA_MAIN_PUSH_DATA = "com.yunshipei.enterplorer.splash.main.push.msg";

    @Override
    public void onReceive(Context context, Intent intent) {
        String url = intent.getStringExtra(PUSH_URL);
        if (!TextUtils.isEmpty(url)) {
            Intent splashIntent = new Intent(context, SplashActivity.class);
            splashIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            splashIntent.putExtra(EXTRA_MAIN_PUSH_DATA, url);
            context.startActivity(splashIntent);
        }
    }
}
